The detection of straight lines and geometrical shapes is an important subject in the field of image processing. In a real scene of an image, given that there are a large number of straight lines and geometrical shapes, it will be of great importance in image processing to realize methods for quickly and accurately detecting the straight lines and the geometrical shapes.
Generally, the method for detecting the geometrical shapes is derived from the method for detecting the straight lines. In the related art, the method of Hough transform is usually used for detecting the straight lines. The Hough transform defines a parameter space, which has a dual relationship with an image, such that one straight line in the image corresponds to one point in the parameter space, and one point in the image corresponds to one sine wave in the parameter space. From the above corresponding relationship, it is known that several collinear points on one straight line in the image correspond to several sine waves, which intersect at the same point in the parameter space. Based on this, a problem of detecting a straight line having maximum collinear points in the image is changed into a problem of detecting a peak point at which the most number of sine waves intersect at one point in the parameter space, and the straight line corresponding to the peak point is the straight line to be detected in the image.
In the above method for detecting the straight lines based on the Hough transform, given that several collinear points need to be sampled in the image, therefore the image needs to be binarized at first, namely, a binary image composed of black pixel points and white pixel points is obtained, and then several collinear points are sampled in the binary image. However, binarization of the image is sensitive to parameters, and it is only applicable for detecting a straight line, which has strong edge strength, i.e. the straight line having a gray value, which obviously differs from gray values of other regions in the image. Moreover, when the edge strength of the straight line is weak or there are noise interferences, then the straight line will be broken, and accuracy of the detection results will be significantly influenced.